using System;
using System.Text;
using System.Collections.Generic;
using iBeauty.BusinessObjects;
using iBeauty.DAL;

namespace iBeauty.BLL
{
	public class StaffBLL
	{
		private StaffDAO _StaffDAO;

		public StaffDAO StaffDAO
		{
			get { return _StaffDAO; }
			set { _StaffDAO = value; }
		}

		public StaffBLL()
		{
			StaffDAO = new StaffDAO();
		}
		public List<Staff> GetStaffs()
		{
			try
			{
				return StaffDAO.GetStaffs();
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public Staff GetStaff(string ID)
		{
			try
			{
				return StaffDAO.GetStaff(ID);
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public int AddStaff(Staff oStaff)
		{
			try
			{
				return StaffDAO.AddStaff(oStaff);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int AddStaff(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string StaffCode,string StaffName,int? ShopId,string Address,string Email,string Phone,int? CommissionType,Single? CommissionByPercent,Single? CommissionByMoney,int? SalaryType,Single? BaseSalary,Single? Allowance1,Single? Allowance2,Single? Allowance3,string AllowanceName1,string AllowanceName2,string AllowanceName3,int? NumOfDependents,Single? PersonalDeduction,string IsRetired,DateTime? StartTime,string Barcode,DateTime? EndTime,DateTime? BreakTime,string WorkList,string IsScheduleWorkTime,string IsCommissionService,string IsServiceCard,int? AccountId,string Note)
		{
			try
			{
				return StaffDAO.AddStaff(ID,CreateDate,ModifiedDate,TimeStamp,StaffCode,StaffName,ShopId,Address,Email,Phone,CommissionType,CommissionByPercent,CommissionByMoney,SalaryType,BaseSalary,Allowance1,Allowance2,Allowance3,AllowanceName1,AllowanceName2,AllowanceName3,NumOfDependents,PersonalDeduction,IsRetired,StartTime,Barcode,EndTime,BreakTime,WorkList,IsScheduleWorkTime,IsCommissionService,IsServiceCard,AccountId,Note);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateStaff(Staff oStaff)
		{
			try
			{
				return StaffDAO.UpdateStaff(oStaff);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateStaff(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string StaffCode,string StaffName,int? ShopId,string Address,string Email,string Phone,int? CommissionType,Single? CommissionByPercent,Single? CommissionByMoney,int? SalaryType,Single? BaseSalary,Single? Allowance1,Single? Allowance2,Single? Allowance3,string AllowanceName1,string AllowanceName2,string AllowanceName3,int? NumOfDependents,Single? PersonalDeduction,string IsRetired,DateTime? StartTime,string Barcode,DateTime? EndTime,DateTime? BreakTime,string WorkList,string IsScheduleWorkTime,string IsCommissionService,string IsServiceCard,int? AccountId,string Note)
		{
			try
			{
				return StaffDAO.UpdateStaff(ID,CreateDate,ModifiedDate,TimeStamp,StaffCode,StaffName,ShopId,Address,Email,Phone,CommissionType,CommissionByPercent,CommissionByMoney,SalaryType,BaseSalary,Allowance1,Allowance2,Allowance3,AllowanceName1,AllowanceName2,AllowanceName3,NumOfDependents,PersonalDeduction,IsRetired,StartTime,Barcode,EndTime,BreakTime,WorkList,IsScheduleWorkTime,IsCommissionService,IsServiceCard,AccountId,Note);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveStaff(Staff oStaff)
		{
			try
			{
				return StaffDAO.RemoveStaff(oStaff);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveStaff(string ID)
		{
			try
			{
				return StaffDAO.RemoveStaff(ID);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public List<Staff> DeserializeStaffs(string Path)
		{
			try
			{
				return GenericXmlSerializer<List<Staff>>.Deserialize(Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public void SerializeStaffs(string Path, List<Staff> Staffs)
		{
			try
			{
				GenericXmlSerializer<List<Staff>>.Serialize(Staffs, Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}
